Next: Inserting Tag Lists, Previous: Developing Template Functions, Up: Top [Index]
For SRecode to work across languages reliably, templates need to follow a predictable pattern. For every language of similar nature (OO, functional, doc based) if they all provide the same base templates, then an application can be written against the base templates, and it will work in each of the supported language.
Having consistent templates also makes it easy to use those
templates from a user perspective during basic interactive
insertion via srecode-minor-mode.
NOTES ON THIS CHAPTER:
These conventions are being worked on. Check w/ CEDET-DEVEL mailing list if you want to support a language, or write an application and provide your opinions on this topic. Any help is appreciated.
Each language should support the file:empty
template. This will generally use the default copyright insertion
mechanism.
Functional languages should attempt to support the following:
functionA standalone function. Not a method, external method, or other.
methodA method belonging to some class declared outside the textual bounds of that class’ declaration.
variableA global variable.
typeA data type. If the language supports several types of datatypes then do not use this, use more specific ones instead.
classFor OO languages, use this instead of
type.
includeInclude files.
For any Semantic tag class in your language, you will likely want to have a corresponding template.
In order for the SRecode function
srecode-semantic-insert-tag to work, you can create
templates similar to those mentioned above, except with
-tag appended to the end. This lets a template like
function have user conveniences when referencing
function-tag, while also allowing the tag inserter
to do its job with a simpler template.
Inside a class definition. These are to be inserted inside the textual bounds of a class declaration.
functionThis would be a method of the class being inserted into.
constructordestructorLike function but specific to alloc/delete of
an object.
variableThis would be a field of the class being inserted into.
Inside a body of code, such as a function or method body.
—no conventions yet.
For these variables to be useful, standard names should be used. These values could be provided directly from a Semantic tag, or by an application.
The name of the declaration being created.
If the item belongs to some parent type, it would be the full name of that type, including namespaces.
A datatype name for a variable, or the return value of a function.
If there is some documentation associated with the item, then DOC should contain the value. (Optional)
The ARGS variable defines a section for 0 or more arguments to a function or method. Each entry in ARGS will follow the rest of these naming conventions, such as for NAME and TYPE.
For templates used by
srecode-semantic-insert-tag, there is also the
following useful dictionary values.
A special insertion value TAG. You can use semantic functions to turn the tag into a string.
Default value for a variable.
Next: Inserting Tag Lists, Previous: Developing Template Functions, Up: Top [Index]